package org.dragon;

import cn.hutool.extra.mail.MailUtil;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Author:     Zhao Yan
 * DateTime:   2023/5/23 10:19
 */
public class Test {

    public static void main(String[] args) {
        // 获取系统当前时间
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
        Date date = new Date(System.currentTimeMillis());
// 拼接邮件html内容，我是先在Html里写好，粘贴过来的
        StringBuilder contentAll = new StringBuilder("批量短信发送失败的人如下：" + "(发送失败的时间 : " + formatter.format(date) + ")" + "<table width=\"70%\" height=\"50px\" align=\"center\" border=\"2\" cellpadding=\"15px\" cellspacing=\"0\"" +
                "<thead>" +
                "<tr>" +
                "<th>id</th> <th>签名</th> <th>电话</th> <th>短信模板</th>" +
                "</tr>" +
                "</thead>");

        contentAll.append("</table>");
// import cn.hutool.extra.mail.MailUtil;
        MailUtil.send("aliqi@dragonscale.org", "你好，测试一下我的邮件是否OK", String.valueOf(contentAll), true);

    }
}
